package com.example.demo.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Invoicing {
    private int invoicId;
    private Timestamp billingDate;
    private BigDecimal billMoney;
    private String content;
    private String ticketType;
    private String invoiceNumber;
    private String ownerb;
    private int yesNo;
    private Client kh;
    private Order htdd;

    @Id
    @Column(name = "invoic_id", nullable = false)
    public int getInvoicId() {
        return invoicId;
    }

    public void setInvoicId(int invoicId) {
        this.invoicId = invoicId;
    }

    @Basic
    @Column(name = "billing_date", nullable = false)
    public Timestamp getBillingDate() {
        return billingDate;
    }

    public void setBillingDate(Timestamp billingDate) {
        this.billingDate = billingDate;
    }

    @Basic
    @Column(name = "bill_money", nullable = false, precision = 2)
    public BigDecimal getBillMoney() {
        return billMoney;
    }

    public void setBillMoney(BigDecimal billMoney) {
        this.billMoney = billMoney;
    }

    @Basic
    @Column(name = "content", nullable = false, length = 255)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "ticket_type", nullable = false, length = 255)
    public String getTicketType() {
        return ticketType;
    }

    public void setTicketType(String ticketType) {
        this.ticketType = ticketType;
    }

    @Basic
    @Column(name = "invoice_number", nullable = false, length = 255)
    public String getInvoiceNumber() {
        return invoiceNumber;
    }

    public void setInvoiceNumber(String invoiceNumber) {
        this.invoiceNumber = invoiceNumber;
    }

    @Basic
    @Column(name = "ownerb", nullable = false, length = 255)
    public String getOwnerb() {
        return ownerb;
    }

    public void setOwnerb(String ownerb) {
        this.ownerb = ownerb;
    }

    @Basic
    @Column(name = "yes_no", nullable = false)
    public int getYesNo() {
        return yesNo;
    }

    public void setYesNo(int yesNo) {
        this.yesNo = yesNo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Invoicing invoicing = (Invoicing) o;
        return invoicId == invoicing.invoicId &&
                yesNo == invoicing.yesNo &&
                Objects.equals(billingDate, invoicing.billingDate) &&
                Objects.equals(billMoney, invoicing.billMoney) &&
                Objects.equals(content, invoicing.content) &&
                Objects.equals(ticketType, invoicing.ticketType) &&
                Objects.equals(invoiceNumber, invoicing.invoiceNumber) &&
                Objects.equals(ownerb, invoicing.ownerb);
    }

    @Override
    public int hashCode() {
        return Objects.hash(invoicId, billingDate, billMoney, content, ticketType, invoiceNumber, ownerb, yesNo);
    }

    @ManyToOne
    @JoinColumn(name = "client_id", referencedColumnName = "client_id", nullable = false)
    public Client getKh() {
        return kh;
    }

    public void setKh(Client kh) {
        this.kh = kh;
    }

    @OneToOne
    @JoinColumn(name = "order_id", referencedColumnName = "order_id", nullable = false)
    public Order getHtdd() {
        return htdd;
    }

    public void setHtdd(Order htdd) {
        this.htdd = htdd;
    }
}
